package com.leaves.javamall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

import com.leaves.common.groups.ListValue;
import com.leaves.common.groups.addGroup;
import com.leaves.common.groups.updateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;


/**
 * 品牌
 *
 * @author leaves
 * @email lxhu.work@gmail.com
 * @date 2020-08-10 16:47:20
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 品牌id
     */
    @Null(message = "新增品牌不能指定ID",groups = {addGroup.class})
    @NotNull(message = "品牌ID不能为空", groups = {updateGroup.class})
    @TableId
    private Long brandId;
    /**
     * 品牌名
     */
    @NotBlank(message = "名称不能为空", groups = {addGroup.class,updateGroup.class})
    private String name;
    /**
     * 品牌logo地址
     */
    @NotEmpty(message = "logo不能为空", groups = {addGroup.class})
    @URL(message = "logo必须为url地址",groups = {addGroup.class,updateGroup.class})
    private String logo;
    /**
     * 介绍
     */
    private String descript;
    /**
     * 显示状态
     */
    @ListValue(vals={1,0},message="请输入正确的显示状态",groups = {addGroup.class,updateGroup.class})
    private Integer showStatus;
    /**
     * 检索首字母
     */
    @NotEmpty(message = "检索首字母不能为空", groups = {addGroup.class})
    @Pattern(regexp = "^[A-Za-z]$" ,message = "检索首字母必须为一个字母",groups = {addGroup.class,updateGroup.class})
    private String firstLetter;
    /**
     * 排序
     */
    @NotNull(message = "排序不能为空", groups = {addGroup.class})
    @Min(value = 0, message = "排序必须大于等于0", groups = {addGroup.class,updateGroup.class})
    private Integer sort;

}
